package com.qiaomengapp.dao;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import com.qiaomengapp.bean.ProviderGood;

public interface ProviderGoodMapper {

	// 显示供应商商品信息
	List<ProviderGood> select_ProviderGood();

	// 根据商品介绍模糊查询
	List<ProviderGood> select_mohu(String goodDesc);

	// 按销量排序
	List<ProviderGood> select_BySaleCount();

	// 显示销售的商品并按佣金排序
	List<ProviderGood> select_ByCommission();

	// 显示销售的商品并按售价排序
	List<ProviderGood> select_ByPrice();
	
	//库存和销量的加减
	@Update("update provider_good set sum=sum+#{a} where id=#{id}")
	int update_sumadd(@Param("a")int a,@Param("id")int id);
	@Update("update provider_good set sum=sum-#{a} where id=#{id}")
	int update_sumreduce(@Param("a")int a,@Param("id")int id);
	@Update("update provider_good set sales_count=sales_count+#{a} where id=#{id}")
	int update_salecount_add(@Param("a")int a,@Param("id")int id);
	@Update("update provider_good set sales_count=sales_count-#{a} where id=#{id}")
	int update_salecount_reduce(@Param("a")int a,@Param("id")int id);
	
	//根据id选出相应的商品信息
	ProviderGood select_ProviderGoodbyId(int id);
}
